<?php

require_once 'contents/AdminPWDContents.php';
/**
 * 专门存放控制器的类
 */
class MainController extends AdminPWDContents
{

    public function index()
    {
        require "render/MainPageRender.php";
    }

    public function about()
    {
        require "render/AboutMeRender.php";
    }

    public function manager_panel($name, $pwd)
    {
        $hash_result = hash('sha256', $pwd, true);
        $Hash_result = hash("sha256", $this->password, true);
        if ($hash_result == $Hash_result && $name == $this->username){
            require 'render/AdminRender.php';
        }
    }

    public function add_article($name){
        require 'template/article/AddArticle.php';
    }

    public function delete_article($name){
        require 'template/article/DeleteArticle.php';
    }

    public function import_style($name){
        require 'template/style/StyleManager.php';
    }

    public function article_index($article_name){
        require 'template/articles_save/' . $article_name . ".html";
    }
}
